home *** CD-ROM | disk | FTP | other *** search
/ SVM Mac 1 / CD-ROM N°1.iso / Utilitaires / Programmation⁄Infos / CDEF Pack 1.1 / Date & Time CDEF / Date & Time CDEF Description next >
Encoding:
Text File  |  1994-04-25  |  5.0 KB  |  123 lines  |  [TEXT/KAHL]

  1. Date & Time CDEF
  2. by Michael F. Kamprath
  3.  
  4. ©1993 by Michael F. Kamprath
  5.  
  6.  
  7. Requirments:
  8. ============
  9.  
  10. This CDEF can only be used with system 7.0 or later.  This is because
  11. this CDEF uses System 7's Color Icon family manager.
  12.  
  13. Description
  14. ===========
  15.  
  16. This CDEF will allow your program to use a point and click method for entering
  17. dates and/or times into your program.  (It will not, however, allow keyed 
  18. entering of dates.  You program can compensate for this, though)  This CDEF uses 
  19. the control record's hilite, value, and refcon fields to manage what the current 
  20. date value is, which part is hilited, and if the "up/down" button is active.   
  21. How the fields are used is as follows:
  22.  
  23.      (*theControl)->contrlHilite  = Control active (=0) or inactive (=255)
  24.                                     (also used to determine what part of the
  25.                                      up/down arrow is to be hilited during
  26.                                      tracking, but this is internal to the CDEF).
  27.      (*theControl)->contrlValue   = Determines which part of the date or time string
  28.                                      (depending on variation code) is to be hilited.
  29.                                      If it is nonzero, the the up/down arrow is
  30.                                      active and detects mouse clicks, otherwise
  31.                                      the up/down arrow is inactive (but drawn if
  32.                                      the hilite is not 255)
  33.      (*theControl)->contrlRfCon      = Contains a _pointer_ to the DateTimeRec to be
  34.                                      controled. 
  35.                                       
  36. This CDEF has two variations, one for time control (varCode=kTimeVariation), and 
  37. one for date control (varCode=kDateVariation).  Both variations use the current
  38. system setting for date and time display (except leading zeros are forced on all
  39. numeric fields).  
  40.  
  41. The basic scheme for using this CDEF is as follows:
  42.  
  43.   1.  #include "DateTimeCDEF.h" in your code.
  44.  
  45.   2. Initialize the control.  A typical initialization would be:
  46.   
  47.        hCtl = NewControl( theWindow, &ctrlRect, title, visible, 
  48.                         initialValue=0, min=0, max=128, 
  49.                         CDEF_ID*16 + varCode, refCon );
  50.   
  51.   It's rect should be about 175(long)x20(high) - fine
  52.   tune this value for your own application.  Also place the pointer to it's 
  53.   refcon field (either at initialization with NewControl() or ASAP with
  54.   GetNewControl() ).  If you want to control both the time and date to a single
  55.   DateTimeRec, put it's point in both the time and date variation controls.
  56.  
  57.   3. When a mouse down occurs within the control, track it as usual.  Then
  58.   if the returned part code is nonzero, do:
  59.   
  60.       If ( partcode != kArrowButtonUp) && ( partcode != kArrowButtonDown )
  61.           ==> Set the control value to the partcode returned.
  62.       Else
  63.           ==> If (control value != zero)
  64.                   ==> Increment or decrement the DateTimeRec according to
  65.                       the partCode returned.
  66.               Else
  67.                   ==> Impossible case.
  68.  
  69.   4. Upon activation or deactivation of the window (or even control), be
  70.   sure to set the -control hilite to either 0 or 255 (as per the situation
  71.   requires).
  72.   
  73.   5. When disposing the control, don't forget to dispoae the pointer to the 
  74.   DateTimeRec (that is, if you allocated a memory block for it rather than
  75.   using a stack variable).
  76.  
  77. If this confuses you, be sure to check out the code for the "CDEF Sampler"
  78. program included with this package.
  79.  
  80. NOTE: The icon id for the up/down arrow is hard coded into the CDEF at
  81. 15000.  You can change the icon supplied with this CDEF, but remember it
  82. should be a 16x16 icon family (ics#), and that the top half is considered
  83. the up button, and the bottom hal if the down button.  Notice that 
  84. icon #15001 represents the "up button depressed" icon, and #15002 represents
  85. the "down button depressed" icon.  All of these (15000-15002) icons must
  86. be defined for the CDEF to work properly.
  87.  
  88. Shareware Info:
  89. ===============
  90.  
  91. If you use this CDEF for personal use, all I ask is that you send me a note
  92. and maybe a copy of the program you use it in.
  93.  
  94. If you use this CDEF for somethiong that you later charge money for (like
  95. your own shareware software or commercial software), the price for it's use
  96. is a one time payment of $5 and maybe a copy of your program.  If you don't 
  97. wish to give me a free copy of your program, I understand (after all, I'm 
  98. asking for money).  
  99.  
  100. If you wish for the source code to this CDEF, I will send it to you if you
  101. include a disk with your shareware payment ($5).  I will not send the source
  102. code out with out the shareware payment or the disk (though I will send it
  103. via e-mail if you send me the shareware payment before I lose my e-mail
  104. account).
  105.  
  106. Please make all payments in U.S. funds.
  107.  
  108. You may contact me by:
  109.  
  110.      e-mail:      kamprath@engin.umich.edu  (valid until Jan, 1994)
  111.  
  112.      postal mail: Michael F. Kamprath
  113.                   481 NW Eleventh Ave.
  114.                   Boca Raton, FL  33486
  115.                   
  116. Legal Stuff
  117. ===========
  118.  
  119. I provide no warranty, written or implied, nor do I accept any responsibility
  120. for damages inflicted, real or imagined, by the use of this CDEF.
  121.  
  122. This CDEF was wrriten in THINK C v5.0.  Therefore, some portions are copyrighted 
  123. by Symantec.